package com.hc.ssm.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.hc.ssm.pojo.Users;

public interface UsersMapper {

	
	@Select("SELECT id,username,age,sex,nickname,address,supper,picpath from users where username=#{account} and PASSWORD =#{password}")
	public Map<String, Object> login(Map<String, Object> map);

	@Update("UPDATE users SET username=#{username},password =#{password} WHERE id=#{id}")
	public int updateUserInfo(Map<String, Object> map);

	@Delete("delete from users where id =#{id}")
	public int deleteUser(Map<String, Object> map);

	@Insert("INSERT into users (username,password,age,sex,nickname,mobile,address,supper,picpath) VALUES(#{username},#{password},#{age},#{sex},#{nickname},#{mobile},#{address},0,#{picpath})")
	public int addUser(Users users);

	@Select("SELECT id,username,nickname,mobile,address,picpath FROM users LIMIT #{indexpage},#{pagesize}")
	public List<Map<String, Object>> findAll(Map<String, Object> map);

	
	@Select("SELECT count(id) count FROM users LIMIT #{indexpage},#{pagesize}")
	public Map<String, Object> countAll(Map<String, Object> map);
	
	@Update("update users set age=#{u.age} where id =#{id} ")
	public int test(Map<String,Object> map);
}
